/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = frssl_config.h                                     */
/*  NOTE      =                                                    */
/*  DATE      = 2015/07/16 by guojq                                */
/*******************************************************************/

#ifndef __FRSSL_CONFIG_H_
#define __FRSSL_CONFIG_H_

#include <openssl/ssl.h>
#include <pcap.h>

#define DSSL_PID_FILE     "../temp/dssl_pid"

#define SSL_ACTION_ADD    1
#define SSL_ACTION_DEL    2
#define SSL_ACTION_CLEAR  3

typedef struct __ssl_info {
    int       i_action;
    u_int     ui_ip;
    u_short   us_port;
    char     *p_file;
    char     *p_passwd;
    char     *p_domain;
} FRSSL_info;

void frssl_read_lock(void);
void frssl_read_unlock(void);

int do_ssl_commit(char **pp_result);
int do_ssl_rollback(void);
int frssl_config_load(void);
int frssl_config_add(u_int ui_ip, u_short us_port
                , const char *p_file_ssl, const char *p_ssl_cert_content, const char *p_passwd, const char *p_domain, char **pp_result);
int frssl_config_del(u_int ui_ip, u_short us_port, const char *p_domain
                , char **pp_result);
FRSSL_info* frssl_config_lookup(u_int ui_ip, u_short us_port);
unsigned long frssl_config_version(void);
int do_ssl_clear_all(char **pp_result);

int frssl_config_init(void);
void frssl_config_destroy(void);

#endif
